\begin{tikzpicture}[>=Stealth,
    every node/.style={fill=white, inner sep=1pt},
]
    \pgfmathsetmacro{\a}{2.5}
    \pgfmathsetmacro{\b}{1.5}

    \draw (0, 0) rectangle (\a + \b, \a + \b);
    \draw (0, \a) -- (\a + \b, \a);
    \draw (\a, 0) -- (\a, \a + \b);

    \node at (\a/2, \a/2) {$a^2$};
    \node at (\a + \b/2, \a/2) {$ab$};
    \node at (\a/2, \a + \b/2) {$ab$};
    \node at (\a + \b/2, \a + \b/2) {$b^2$};

    \draw [<->] (0, -0.3) to [xianduan={above=0.3cm}]  node {$a$} (\a, -0.3);
    \draw [<->] (\a, -0.3) to [xianduan={above=0.3cm}] node {$b$} (\a+\b, -0.3);
    \draw [<->] (-0.3, 0) to [xianduan={below=0.3cm}]  node {$a$} (-0.3, \a);
    \draw [<->] (-0.3, \a) to [xianduan={below=0.3cm}] node {$b$} (-0.3, \a+\b);
\end{tikzpicture}

